package signAction;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import signBean.Manager;
import signBean.UserManager;

public class WorkAjaxAction {
	private String username;

	private String classname;
	private String phone;
	List list1;
	public List getList1() {
		return list1;
	}

	public void setList(List list1) {
		this.list1 = list1;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getClassname() {
		return classname;
	}

	public void setClassname(String classname) {
		this.classname = classname;
	}
	public String execute() throws UnsupportedEncodingException, SQLException {
		 HttpServletResponse response = null; 
		 HttpServletRequest request = ServletActionContext.getRequest();
		 response = ServletActionContext.getResponse();   
		 request.setCharacterEncoding("utf-8");
		 response.setContentType("text/html;charset=utf-8");
		boolean ff= new Manager().checkUserName(classname);
		 
		
		if(ff){
				StringBuffer resultString=new StringBuffer("true");
			try {
				ServletActionContext.getResponse().getWriter().print(resultString.toString());
			} catch (IOException e) {
				
				e.printStackTrace();
			}
		}
		return null;
		 }

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}
}
